package com.mad.gdrapps;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

public class BanglaSahibSplashScr extends Activity {

    private static final int STOPSPLASH = 0;
	private static final long SPLASHTIME = 3000;
    private ImageView splash;

    
	public void onCreate(Bundle savedInstance){
		
		super.onCreate(savedInstance);
		setContentView(R.layout.splash);
		
		/**  TextView splashTV = (TextView) findViewById(R.id.splashTV);
		 
		 ImageView spplash = (ImageView)findViewById(R.id.splashIV);
		 Message msg = new Message();
         msg.what = STOPSPLASH;
         splashHandler.sendMessageDelayed(msg, SPLASHTIME); */
         
         
         Thread splashThread = new Thread() {
             @Override
             public void run() {
                try {
                   int waited = 0;
                   while (waited < 5000) {
                      sleep(100);
                      waited += 100;
                   }
                } catch (InterruptedException e) {
                   // do nothing
                } finally {
                   finish();
                   Intent i = new Intent();
                   i.setClassName("com.testing.splashscreensample",
                                  "com.testing.splashscreensample.mainmenu");
               	   
                   startActivity(new Intent(getApplicationContext(), TopicsScr.class));
               	   
                  // startActivity(i);
                }
             }
          };
          splashThread.start();
          
	}
	
	
	private Handler splashHandler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
                switch (msg.what) {
                case STOPSPLASH:
                        //remove SplashScreen from view
                        splash.setVisibility(View.GONE);
                        
                        	startActivity(new Intent(getApplicationContext(), TopicsScr.class));
                        
                        break;
                }
                super.handleMessage(msg);
        }
	};

}
